#include <cstdio>
#include <cstring>

int main( )
{
    int n, p, t, q;
    int f[] = {0, 1, 2, 0, 3, 4, 5, 6, 0, 7 };
    while ( scanf("%d", &n) && n )
    {
        t = 1;
        p = 0;
        q = n;
        while ( n )
        {
            p += t * f[ n % 10 ];
            n /= 10;
            t *= 8;
        }
        printf("%d: %d\n", q, p);
    }
    return 0;
}
